package p6;

/**
 * @author krystal
 * @date 2022/11/11 16:29
 */
class Student{
    //普通成员变量
    public String name;
    public String gendet;
    public int age;
    //静态成员变量
    private static String classRoom="java1";

    public Student(String name, String gendet, int age) {
        this.name = name;
        this.gendet = gendet;
        this.age = age;
    }

    {
        System.out.println("实例代码块");
    }

    static {
        System.out.println("静态代码块");
    }

    public static String getClassRoom() {
        return classRoom;
    }
}

public class Demo3 {
    public static void main(String[] args) {
        System.out.println(Student.getClassRoom());

//        //直接通过类名来访问静态成员变量
//        System.out.println(Student.classRoom);
//        //通过对象来访问
//        Student s=new Student("抽抽","male",23);
//        System.out.println(s.classRoom);
    }
}
